<?php
include_once ("batchDBManager.php");
function getStatusByVideoId($videoId,$carrierId) {
    $batchM = new BatchDBManager();
    return $batchM->getStatus($videoId,$carrierId);

}

function getCarrierName($carrier_id) {
    if ($carrier_id=="1"){
        return "au";
    }
    else if ($carrier_id ==" 2"){
        return  "docomo";
    }
    else if ($carrier_id == "3"){
         return  "softbank";
    }
    return "";
}

function getGifImageByVideoId($videoId,$carrier_id) {
    if ($carrier_id=="1"){
	return "/video/$videoId/docomo/images/deco/$videoId"."_00.gif";
    }
    else if ($carrier_id ==" 2"){
	return "/video/$videoId/au/images/deco/$videoId"."_00.gif";
    }
    else if ($carrier_id == "3"){
	return "/video/$videoId/softbank/images/deco/$videoId"."_00.gif";
    }else {
        return "/video/$videoId/docomo/images/deco/$videoId"."_00.gif";
    }
}


function getEntryImageByVideoId($videoId,$carrier_id) {
    if ($carrier_id=="1"){
	return "/video/$videoId/docomo/images/screensaver/$videoId.gif";
    }
    else if ($carrier_id ==" 2"){
	return "/video/$videoId/au/images/screensaver/$videoId.gif";
    }
    else if ($carrier_id == "3"){
	return "/video/$videoId/softbank/images/screensaver/$videoId.gif";
    } else  {
        return "/video/$videoId/docomo/images/screensaver/$videoId.gif";
    }
}

function get3gpDirByVideoId($videoId,$carrier_id) {
    if ($carrier_id=="1"){
        return "/video/$videoId/docomo/3gp/d";
    }
    else if ($carrier_id ==" 2"){
        return "/video/$videoId/au/3gp";
    }
    else if ($carrier_id == "3"){
        return "/video/$videoId/softbank/3gp";
    }

    return "";

}

function getDocomoS3gpDirByVideoId($videoId) {
    return "/video/$videoId/docomo/3gp/s";
}

function getThumbnailArray($videoId,$carrier_id) {
    $src_path=null;
    $ret_pat=null;
    if ($carrier_id == 1) {
        $src_path="/var/www/vhdocs/mobile/video/$videoId/docomo/images/thumbnail";
        $ret_pat="/video/$videoId/docomo/images/thumbnail";
    } else if ($carrier_id == 2) {
        $src_path="/var/www/vhdocs/mobile/video/$videoId/au/images/thumbnail";
        $ret_pat="/video/$videoId/au/images/thumbnail";
    } else if ($carrier_id == 3) {
        $src_path="/var/www/vhdocs/mobile/video/$videoId/softbank/images/thumbnail";
        $ret_pat="/video/$videoId/softbank/images/thumbnail";
    } else {
        $src_path="/var/www/vhdocs/mobile/video/$videoId/docomo/images/thumbnail";
        $ret_pat="/video/$videoId/docomo/images/thumbnail";
    }
    
    $fileArray = array();
    if ($dh = opendir($src_path)) {
        while(($dat = readdir($dh)) !== false) {
           if ( $dat != "." && $dat != ".." ) {
               array_push($fileArray,  "$ret_pat/$dat");
           }
        }
        closedir ( $dh );
    }
    sort($fileArray);
    return $fileArray;
}
?>
